package com.sh.learn.manning.springinaction.chapter01.aop;

import java.lang.reflect.Method;
import org.apache.log4j.Logger;
import org.springframework.aop.MethodBeforeAdvice;
import com.sh.learn.manning.springinaction.chapter01.di.Knight;

public class MinstrelAdvice implements MethodBeforeAdvice {
	
	public void before(Method method, Object[] args, Object target) throws Throwable {

		Knight knight = (Knight) target;
		Logger song = Logger.getLogger(target.getClass());
		song.debug("Brave " + knight.getName() + " did " + method.getName());
	}
}
